package com.colin.app.activity.senior.animation;

import android.view.View;
import android.view.animation.AnimationUtils;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.colin.app.R;
import com.colin.app.activity.senior.SeniorContract;
import com.colin.app.activity.senior.SeniorPresenterImpl;
import com.colin.app.app.AppActivity;
import com.colin.app.bean.DemoBean;


public class AnimationActivity extends AppActivity implements SeniorContract.SeniorView {
    private SeniorContract.SeniorPresenter mSeniorPresenter = null;
    private LinearLayout linear_animation_view;
    private TextView text_animation_name;

    @Override
    protected void onDestroy() {
        if (null != mSeniorPresenter) {
            mSeniorPresenter.destroy();
            mSeniorPresenter = null;
        }
        super.onDestroy();
    }

    @Override
    public void initPresenter() {
        DemoBean demoBean = getIntent().getExtras().getParcelable("clazz");
        mSeniorPresenter = new SeniorPresenterImpl(this, this, demoBean);
    }


    @Override
    public int initViewLayoutID() {
        return R.layout.activity_animation;
    }

    @Override
    public void initView() {
        this.linear_animation_view = (LinearLayout) this.findViewById(R.id.linear_animation_view);
        this.text_animation_name = (TextView) this.findViewById(R.id.text_animation_name);
    }

    @Override
    public void initData() {
        mSeniorPresenter.setData();
    }

    public void animationAlpha(View view) {
        view.startAnimation(AnimationUtils.loadAnimation(this, R.anim.shake));
        mSeniorPresenter.animationAlpha(linear_animation_view, text_animation_name);
    }

    public void animationRotate(View view) {
        view.startAnimation(AnimationUtils.loadAnimation(this, R.anim.shake));
        mSeniorPresenter.animationRotate(linear_animation_view, text_animation_name);
    }

    public void animationRotateSelf(View view) {
        view.startAnimation(AnimationUtils.loadAnimation(this, R.anim.shake));
        mSeniorPresenter.animationRotateSelf(linear_animation_view, text_animation_name);
    }

    public void animationTranslate(View view) {
        view.startAnimation(AnimationUtils.loadAnimation(this, R.anim.shake));
        mSeniorPresenter.animationTranslate(linear_animation_view, text_animation_name);
    }

    public void animationScale(View view) {
        view.startAnimation(AnimationUtils.loadAnimation(this, R.anim.shake));
        mSeniorPresenter.animationScale(linear_animation_view, text_animation_name);
    }

    public void animationScaleSelf(View view) {
        view.startAnimation(AnimationUtils.loadAnimation(this, R.anim.shake));
        mSeniorPresenter.animationScaleSelf(linear_animation_view, text_animation_name);
    }

    public void animationSet(View view) {
        view.startAnimation(AnimationUtils.loadAnimation(this, R.anim.shake));
        mSeniorPresenter.animationSet(linear_animation_view, text_animation_name);
    }

    public void animationPropertyValuesHolder(View view) {
        view.startAnimation(AnimationUtils.loadAnimation(this, R.anim.shake));
        mSeniorPresenter.animationPropertyValuesHolder(linear_animation_view, text_animation_name);
    }

    public void animationSetCopyHolder(View view) {
        view.startAnimation(AnimationUtils.loadAnimation(this, R.anim.shake));
        mSeniorPresenter.animationSetCopyHolder(linear_animation_view, text_animation_name);
    }

    public void animationValues(View view) {
        view.startAnimation(AnimationUtils.loadAnimation(this, R.anim.shake));
        mSeniorPresenter.animationValues(linear_animation_view, text_animation_name);
    }

    public void animationXML(View view) {
        view.startAnimation(AnimationUtils.loadAnimation(this, R.anim.shake));
        mSeniorPresenter.animationXML(linear_animation_view, text_animation_name);
    }
}
